/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ru.ibrae.mchs.radiation.entities;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author murr
 */
@Entity
@Table(name = "comment", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"ID_COMENT"})})
@NamedQueries({
    @NamedQuery(name = "Comment.findAll", query = "SELECT c FROM Comment c"),
    @NamedQuery(name = "Comment.findByIdComent", query = "SELECT c FROM Comment c WHERE c.idComent = :idComent"),
    @NamedQuery(name = "Comment.findByComentary1", query = "SELECT c FROM Comment c WHERE c.comentary1 = :comentary1"),
    @NamedQuery(name = "Comment.findByComentary2", query = "SELECT c FROM Comment c WHERE c.comentary2 = :comentary2")})
public class Comment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_COMENT", nullable = false)
    private Integer idComent;
    @Lob
    @Column(name = "COMENTARY", length = 16777215)
    private String comentary;
    @Column(name = "COMENTARY1", length = 200)
    private String comentary1;
    @Column(name = "COMENTARY2", length = 150)
    private String comentary2;
    @OneToMany(mappedBy = "comment")
    private Set<Geoobject> geoobjectSet;

    public Comment() {
    }

    public Comment(Integer idComent) {
        this.idComent = idComent;
    }

    public Integer getIdComent() {
        return idComent;
    }

    public void setIdComent(Integer idComent) {
        this.idComent = idComent;
    }

    public String getComentary() {
        return comentary;
    }

    public void setComentary(String comentary) {
        this.comentary = comentary;
    }

    public String getComentary1() {
        return comentary1;
    }

    public void setComentary1(String comentary1) {
        this.comentary1 = comentary1;
    }

    public String getComentary2() {
        return comentary2;
    }

    public void setComentary2(String comentary2) {
        this.comentary2 = comentary2;
    }

    public Set<Geoobject> getGeoobjectSet() {
        return geoobjectSet;
    }

    public void setGeoobjectSet(Set<Geoobject> geoobjectSet) {
        this.geoobjectSet = geoobjectSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idComent != null ? idComent.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Comment)) {
            return false;
        }
        Comment other = (Comment) object;
        if ((this.idComent == null && other.idComent != null) || (this.idComent != null && !this.idComent.equals(other.idComent))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "JPAtest.entities.Comment[idComent=" + idComent + "]";
    }

}
